﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using WPFExcelReport.Helpers;
namespace WPFExcelReport
{
    public partial class TVKKOPF
    { 
        public TVKKOPF()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            MV = new VVKKOPF(); 
            this.DataContext = MV;
            InitializeComponent();
            AUFART = "NA";
            SACHBE = app.User; 
        }

        public override void QueryCommand(object sender, System.Windows.RoutedEventArgs e)
        {
            SResult = TMV.VVVKK(KRS, LFD, LIEFSCH);
            MergeData(SResult, true);
            base.QueryCommand(sender, e);
        } 

        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
          
            DataSet Set = new DataSet(); 
            cDR.DocType = PRTYPE;
            Set=INTEXBL.QueryVKK(app.Mandant, dwVKK["VKKAUFKRS"].ToString(), dwVKK["VKKAUFLFD"].ToString());
            dwData = VSDDAT.SD22.TBMain.NewRow();
            dwData["SDSA"] = "0013";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));
            dwData["SDSA"] = "0114";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));
            dwData["SDSA"] = "0208";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));
            dwData["SDSA"] = "0734";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));

            dwData["SDSA"] = "0241";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));

            dwData["SDSA"] = "0477";
            Set.Merge(INTEXDBC.QuerySDDAT(dwData, 9999));
            Set.Merge(INTEXDBC.QueryHRSTAMM(dwData, 3));
            cDR.PRINT(Set);
        }

        public override void SaveCommand(object sender, RoutedEventArgs e)
        {
            Update();
            base.SaveCommand(sender, e);
        } 
      
    }
}
